/* GUI CONVERTED from rcmbiq.p (converter v1.76) Mon Aug 27 14:51:36 2001 */
/* rcmbiq.p - MASTER BILL INQUIRY                                             */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.7.1.5 $                                                        */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 7.5      LAST MODIFIED: 03/20/95   BY: GWM *J049                 */
/* REVISION: 8.5      LAST MODIFIED: 07/02/96   BY: ajw *J0XC                 */
/* REVISION: 8.6      LAST MODIFIED: 08/29/96   BY: *K003* Vinay Nayak-Sujir  */
/* REVISION: 8.6      LAST MODIFIED: 04/07/97   BY: *K09R* Vinay Nayak-Sujir  */
/* REVISION: 8.6      LAST MODIFIED: 04/15/97   BY: *K08N* Steve Goeke        */
/* REVISION: 8.6      LAST MODIFIED: 10/07/97   BY: bvm *K0MP*                */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown         */
/* Old ECO marker removed, but no ECO header exists *J0XC*                    */
/* Revision: 1.7.1.3    BY: Jean Miller    DATE: 03/22/01 ECO: *P008*         */
/* $Revision: 1.7.1.5 $    BY: Anil Sudhakaran  DATE: 08/27/01 ECO: *M1JC* */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rcmbiq_p_1 "Master Bill"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcmbiq_p_2 "Ship-From"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcmbiq_p_3 "Ship-To"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcmbiq_p_4 "Shipper"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcmbiq_p_5 "UM"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

/* LOCAL VARIABLES */
define variable site like abs_shipfrom no-undo.
define variable shipper_id like abs_id no-undo.
define variable site_lo as character no-undo.
define variable site_hi as character no-undo.
define variable shipper_lo as character no-undo.
define variable shipper_hi as character no-undo.
define variable prefix as character format "X" no-undo.

define variable disp_abs_id like abs_id no-undo.
define variable disp_shipfrom as character no-undo.
define variable disp_shipto as character no-undo.
define variable disp_gwt like abs_gwt no-undo.
define variable disp_um as character format "XX" no-undo.
define variable disp_abs_type as character format "x(2)" label "T" no-undo.

/* FROZEN SCHEMA FIELDS */
{rcmbrpa.i}

/* BUFFERS */
define buffer abs_ship for abs_mstr.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   site             label {&rcmbiq_p_2}
   shipper_id       label {&rcmbiq_p_1}
with frame a width 80 attr-space no-underline THREE-D /*GUI*/.

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

FORM /*GUI*/ 
   disp_shipfrom label {&rcmbiq_p_2} at 2
   disp_abs_type
   disp_abs_id   label {&rcmbiq_p_4} format "x(20)"
   disp_shipto   label {&rcmbiq_p_3}
   ad_name                           format "x(18)"
   disp_gwt
   disp_um label {&rcmbiq_p_5}
with STREAM-IO /*GUI*/  frame b width 80 down.

/* SET EXTERNAL LABELS */
setFrameLabels(frame b:handle).

site = global_site.

{wbrp01.i}

mainloop:

repeat:

   if c-application-mode <> "WEB" then
   update
      site
      shipper_id
   with frame a editing:

      if input site <> "" then global_site = input site.

      if frame-field = "site" then do:
         /* FIND NEXT/PREVIOUS RECORD */
         {mfnp.i si_mstr site si_site site si_site si_site}
         if recno <> ? then do:
            site = si_site.
            display site with frame a.
         end.
      end.
      else if frame-field = "shipper_id" then do:
         {mfnp05.i abs_mstr abs_id
            "abs_shipfrom = input site and abs_id begins 'm'"
            abs_id "'m' + input shipper_id"}
         if recno <> ? then do:
            shipper_id = substring(abs_id,2).
            display shipper_id with frame a.
         end.
      end.
      else do:
         status input.
         readkey.
         apply lastkey.
      end.

   end.

   {wbrp06.i &command = update &fields = "  site shipper_id" &frm = "a"}

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "terminal" &printWidth = 80
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}

   /* SET THE SELECTION RANGES */
   /* SITE */
   if site = "" then do:
      site_lo = "".
      site_hi = hi_char.
   end.
   else do:
      site_lo = site.
      site_hi = site.
   end.

   /* SHIPPER */
   if shipper_id = "" then do:
      shipper_lo = "M".
      shipper_hi = "M" + hi_char.
   end.
   else do:
      shipper_lo = "M" + shipper_id.
      shipper_hi = "M" + shipper_id.
   end.

   do with frame b:

      clear frame b all no-pause.

      /* DISPLAY THE RECORDS */
      for each abs_mstr
         where abs_shipfrom >= site_lo and abs_shipfrom <= site_hi
           and abs_id >= shipper_lo and abs_id <= shipper_hi
      no-lock:

         find ad_mstr where ad_addr = abs_shipto no-lock no-error.

         assign
            disp_abs_type = caps(substring(abs_id,1,1))
            disp_abs_id = substring(abs_id,2).

         display
            abs_shipfrom @ disp_shipfrom
            disp_abs_type
            disp_abs_id
            abs_shipto   @ disp_shipto
            ad_name
               when (available ad_mstr)
            abs_gwt      @ disp_gwt
            abs_wt_um    @ disp_um
         with frame b STREAM-IO /*GUI*/ .

         down 1 with frame b.

         
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/


         /* IF ABOVE RECORD IS A MASTER THEN SHOW ALL OF THE SHIPPER */
         /* RECORDS ASSOCIATED WITH THE MASTER RECORD               */
         if abs_id begins "M" then do:

            for each abs_ship
               where abs_ship.abs_master_id = abs_mstr.abs_id
            no-lock:

               find ad_mstr where ad_addr = abs_shipto
               no-lock no-error.

               assign
                  disp_abs_type = caps(substring(abs_id,1,1))
                  disp_abs_id = substring(abs_id,2).

               display
                  abs_shipfrom @ disp_shipfrom
                  disp_abs_type
                  disp_abs_id
                  abs_shipto   @ disp_shipto
                  ad_name
                     when (available ad_mstr)
                  abs_gwt      @ disp_gwt
                  abs_wt_um    @ disp_um
               with frame b STREAM-IO /*GUI*/ .

               down 1 with frame b.

               
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/


            end. /* FOR EACH ABS_SHIP */

         end. /* IF ABS_ID BEGINS M */

      end. /* FOR EACH ABS_MSTR */

   end. /* DO WITH FRAME B */

   {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


end. /* mainloop */

{wbrp04.i &frame-spec = a}
